<template>
  <el-checkbox-group v-model="checkList" @change="checkboxfn">
    <el-row>
      <el-col v-for="item,index in value" :key="index">
        <el-checkbox
          :label="item.code"
          style="margin-right:30px"
        >{{ item.code }}</el-checkbox>
        <el-input v-model="value[index].title" style="width:300px;" />
        <span class="uppic">
          <UploadImage v-model="value[index].img" />

        </span>
      </el-col>
    </el-row>

  </el-checkbox-group>
</template>
<script>
import UploadImage from './uploadimage.vue'

export default {
  name: 'Checkboxtitem',
  components: {
    UploadImage
  },
  props: {
    abcd: {
      type: [Array],
      required: true
    },
    value: {
      type: [Array],
      required: true
    }
  },
  data() {
    return {
      checkList: []
    }
  },
  watch: {

  },
  created() {
    const arr1 = []
    // console.log(this.value)
    this.value.forEach((i) => {
      if (i.isRight) {
        arr1.push(i.code)
      }
    })
    this.checkList = arr1
  },
  methods: {
    checkboxfn(val) {
      this.value.forEach((item) => {
        item.isRight = 0
      })
      this.value.filter((item) => {
        val.forEach(i => {
          if (item.code === i) {
            item.isRight = 1
          }
        })
      })
    },
    handlePictureCardPreview() {

    },
    handleRemove() {

    }
  }
}
</script>
<style lang="scss" scoped>
.uppic{
  position: relative;
  ::v-deep .el-upload--picture-card{
  position: absolute;
  left: 380px;
  top: -43px;
    width:100px;
    height: 50px;
    position: relative;
    .el-icon-circle-close{
      position: absolute;
      right: -5px;
      top: -5px;
      font-size: 14px;
    }
    .pic{

      font-size: 15px;
      position: absolute;
      left: 20px;
      top: -46px;
    }
  }

}

</style>
